import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 殇
 * Date: 2025-07-25
 * Time: 10:26
 */
public class Test3 {
    public static void LeftRotateString(String str,int n){
        StringBuilder s=new StringBuilder(str);
        String tmp=s.substring(0,n);
        s.delete(0,n);
        s.append(tmp);
        str=s.toString();
        System.out.println(str);
    }

    public static String test(String str){
        StringBuilder s=new StringBuilder();
        int n=str.length();
        if(n==0) return null;
        if(n==1){
            s.append(str).append("1");
            return s.toString();
        }
        int start=0;
        for(int i=1;i<n;i++){
            if(str.charAt(i)!=str.charAt(start)){
                s.append(str.charAt(start)).append(String.valueOf(i-start));
                start=i;
            }
        }
        if(str.charAt(start)==str.charAt(n-1)){
            s.append(str.charAt(start)).append(String.valueOf(n-start));
        }
        return s.toString();

    }


    public static int countNum(String str){
        int n=str.length();
        int count=0;
        for(int i=0;i<n;i++){
            if(Character.isDigit(str.charAt(i))==true){
                count++;
            }
        }
        return count;
    }

    public static void printArray(int[] array,int len){
        if(len==0)
            return ;
        System.out.print(array[len-1]);
        printArray(array,len-1);
    }
    public static void main(String[] args) {
        LeftRotateString("abcdef",2);
        StringBuilder s=new StringBuilder("I am a student");
        s.reverse();
        System.out.println();
        //--------------------------------------------------
        test("abbcccdeeffff");

        //--------------------------------------------------
        countNum("bit666keji123");
        //--------------------------------------------------
        printArray(new int[]{1,2,3,4,5},5);
    }
}
